package system

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/net/ghttp"
	"github.com/sagoo-cloud/sagooiot/api/v1/common"
)

// GetAppUpgradeListReq 获取数据列表
type GetAppUpgradeListReq struct {
	g.Meta `path:"/app_upgrade/list" method:"get" summary:"获取app包管理列表" tags:"app包管理"`
	common.PaginationReq
}
type GetAppUpgradeListRes struct {
	Data []GetAppUpgradeByIdRes
	common.PaginationRes
}

// GetAppUpgradeByIdReq 获取指定ID的数据
type GetAppUpgradeByIdReq struct {
	g.Meta `path:"/app_upgrade/get" method:"get" summary:"获取app包管理" tags:"app包管理"`
	Id     int `json:"id"        description:"id" v:"required#id不能为空"`
}
type GetAppUpgradeByIdRes struct {
	Version   string `json:"version"          description:"版本号"`
	Name      string `json:"name"          description:"升级包名称"`
	Descript  string `json:"descript"          description:"升级包说明"`
	Path      string `json:"path"          description:"升级包地址"`
	CreatedAt string `json:"CreatedAt"          description:""`
	UpdatedAt string `json:"updatedAt"          description:""`
	Id        string `json:"id"          description:""`
}

// AddAppUpgradeReq 添加数据
type AddAppUpgradeReq struct {
	g.Meta   `path:"/app_upgrade/add" method:"post" summary:"添加app包管理" tags:"app包管理"`
	File     *ghttp.UploadFile `json:"file" type:"file" dc:"选择上传文件"`
	Version  string            `json:"version"          description:"版本号"`
	Name     string            `json:"name"          description:"升级包名称"`
	Descript string            `json:"descript"          description:"升级包说明"`
}
type AddAppUpgradeRes struct{}

// EditAppUpgradeReq 编辑数据api
type EditAppUpgradeReq struct {
	g.Meta    `path:"/app_upgrade/edit" method:"put" summary:"编辑app包管理" tags:"app包管理"`
	Name      string `json:"name"          description:"升级包名称"`
	Descript  string `json:"descript"          description:"升级包说明"`
	CreatedAt string `json:"CreatedAt"          description:""`
	UpdatedAt string `json:"updatedAt"          description:""`
	Id        string `json:"id"          description:"" v:"required#缺少id"`
	Version   string `json:"version"          description:"版本号"`
}
type EditAppUpgradeRes struct{}

// DeleteAppUpgradeReq 删除数据
type DeleteAppUpgradeReq struct {
	g.Meta `path:"/app_upgrade/delete" method:"delete" summary:"删除app包管理" tags:"app包管理"`
	Ids    []int `json:"ids"        description:"ids" v:"required#ids不能为空"`
}
type DeleteAppUpgradeRes struct{}

type RestartAppUpgradeReq struct {
	g.Meta `path:"/app_upgrade/restart" method:"post" summary:"升级" tags:"app包管理"`
	Id     int `json:"id"        description:"ids" v:"required#id不能为空"`
}
type RestartAppUpgradeRes struct{}
